package cn.csxw.openchina.ui.activity;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.Window;

import javax.inject.Inject;

import cn.csxw.openchina.R;
import cn.csxw.openchina.base.BaseActivity;
import cn.csxw.openchina.dagger2.component.DaggerSplashActivityComponent;
import cn.csxw.openchina.dagger2.module.SplashActivityModule;
import cn.csxw.openchina.dagger2.presenter.SplashActivityPresenter;


/**
 * 导航界面
 */

public class SplashActivity extends BaseActivity {


    @Inject
    SplashActivityPresenter mSplashActivityPresenter;

    private static final int ENTER_MAIN = 1;
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                case ENTER_MAIN:
                    enterMainActivity();
                    break;
            }
        }
    };
    private void enterMainActivity() {

        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
    @Override
    public int getLayoutRes() {
        this.supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        return R.layout.activity_splash;
    }
    @Override
    public void initView() {
        DaggerSplashActivityComponent.builder()
                .splashActivityModule(new SplashActivityModule(this))
                .build().inject(this);
        mSplashActivityPresenter.callNetWork("834787183@qq.com", "wgc498503", 1);
        mHandler.sendEmptyMessageDelayed(ENTER_MAIN,1000);
    }
    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View v, int id) {

    }
}
